from django.http import JsonResponse
from django.shortcuts import render

# Create your views here.
from django.views import View

from .models import User


class UsernameCountView(View):
    def get(self, request, username):
        # 步骤
        #      1 接受用户名
        print(username)
        count = User.objects.filter(username=username).count()
        return JsonResponse({"count": count, "code": "0", "errmsg": "OK"})
